package com.orphan.marketFront.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.orphan.marketFront.po.AllDeposit;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lucangtian
 * @since 2021-07-19
 */
@Repository
public interface AllDepositMapper extends BaseMapper<AllDeposit> {
    @Insert("insert into t_all_deposit (u_id,accumulated_deposit) values (#{id},#{money})")
    int insert(Long id,int money);

    @Update("update t_all_deposit set accumulated_deposit=accumulated_deposit+#{money} where u_id=#{id}")
    int update(@Param("id") Long id, @Param("money")int money);

    @Select("select deposit_id,u_id,accumulated_deposit from t_all_deposit where u_id=#{id}")
    AllDeposit selectById(Long id);

}
